package com.web.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA.
 * User: xf
 * Date: 2016/5/7
 * Time: 14:16
 * To change this template use Editor | File and Code Templates.
 */
@Controller
public class MarcoController {

    private static final Logger logger = LoggerFactory.getLogger(MarcoController.class);

//    @Autowired
//    private SimpMessageSendingOperations messaging;

    /**
     * 接受消息，返回的消息会经过消息代理，然后返回到客户端
     *
     * @param incoming
     * @return
     */
//    @MessageMapping("/marco")
//    public Shout handleShout(Shout incoming) {
//        logger.debug("Received message: " + incoming.getMessage());
//        System.out.println("Received message: " + incoming.getMessage());
//        Shout out = new Shout();
//        out.setMessage("Polo!");
//        return out;
//    }

    /**
     * 处理订阅，不会经过消息代理，直接返回到客户端
     *
     * @return
     */
//    @SubscribeMapping("/subscribe")
//    public Shout handleSubscription() {
//        Shout out = new Shout();
//        out.setMessage("Polo!");
//        return out;
//    }

//    @RequestMapping("/marco")
//    public void broadcast() {
//        messaging.convertAndSend("/topic/indexfeed", JodaTimeUtils.getTime("yyyy-MM-dd HH:mm:ss"));
//    }


}
